package com.example.onlineeducation.data.model

import android.os.Parcelable
import androidx.recyclerview.widget.DiffUtil
import kotlinx.android.parcel.Parcelize

@Parcelize
data class OfflineExamListDataModel(
    val id: String?,//id
    val examName: String,//考试名字
    val examImage: String,//考试图片
    val topicId: String?,//专题ID
    val topicName: String,//专题名称
    val startTime: String?,//开始时间
    val endTime: String?,//结束时间
    val totalScore: String,//总分
) : Parcelable {
    companion object {
        val diffCallback = object : DiffUtil.ItemCallback<OfflineExamListDataModel>() {
            override fun areItemsTheSame(
                oldItem: OfflineExamListDataModel,
                newItem: OfflineExamListDataModel
            ): Boolean {
                return oldItem.id == newItem.id
            }

            override fun areContentsTheSame(
                oldItem: OfflineExamListDataModel,
                newItem: OfflineExamListDataModel
            ): Boolean {
                return oldItem.id == newItem.id
                        && oldItem.examName == newItem.examName
                        && oldItem.examImage == newItem.examImage
                        && oldItem.topicId == newItem.topicId
                        && oldItem.topicName == newItem.topicName
                        && oldItem.startTime == newItem.startTime
                        && oldItem.endTime == newItem.endTime
                        && oldItem.totalScore == newItem.totalScore
            }
        }
    }
}